﻿using AttributeRouting.Web.Http;
//using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Water.Model;

namespace Water.RestService.Controllers
{
    public class MeterPlanController : ApiController
    {

        private MeterPlanQuery mpq;
        private MeterPlan mp;

        [GET("GetMeterPlans/{yy}")]
        public IList<MeterPlanQuery> GetMeterPlans(string yy)
        {
            mpq = new MeterPlanQuery();
            return mpq.GetMeterPlans(yy);
        }
        /*
        [POST("GetMeterPlansCount")]
        public int PostGetMeterPlansCount(MeterPlan info)
        {
            var where = MeterPlanWhere(info);
            int count = mpr.LoadCount(where);
            return count;
        }
        */
        [POST("AddMeterPlan")]
        public bool PostAddMeterPlan(MeterPlan info)
        {
            mp = new MeterPlan();
            bool result = mp.AddMeterPlans(info) > 0 ? true : false;
            return result;
        }

        /*
        [POST("EditMeterPlan")]
        public bool PostEditMeterPlan(MeterPlan info)
        {
            bool result = mpr.Edit(info);
            return result;
        }

        [GET("DeleteMeterPlan/{code}")]
        public bool GetDeleteMeterPlan(string code)
        {
            bool result = mpr.Delete(code);
            return result;
        }

        [GET("GetMeterPlan/{code}")]
        public MeterPlan GetMeterPlan(string code)
        {
            var result = mpr.Get(code);
            return result;
        }
         * */
    }
}
